package com.fallsvc.product.controller;

import com.fallsvc.product.model.ProductInfo;
import com.fallsvc.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther falls_vc
 * description:
 * @date 2025/5/25  21:53
 */
@Slf4j
@RequestMapping("/product")
@RestController
public class ProductController {
    @Autowired
    private ProductService productService;
    @RequestMapping("/{productId}")
    public ProductInfo selectProductById(@PathVariable("productId") Integer productId) {
        log.info("接受参数 productId：{}",productId);
        return productService.selectProductById(productId);
    }

    @RequestMapping("/p1")
    public String p1(Integer id){
        return "product-service 接受到参数为 id:"+id;
    }
    @RequestMapping("/p2")
    public String p2(Integer id,String name){
        return "product-service 接受到参数为 id:"+id+" name:"+name;
    }
    @RequestMapping("/p3")
    public String p3(ProductInfo productInfo){
        return "product-service 接受到参数为"+productInfo;
    }
    @RequestMapping("/p4")
    public String p4(@RequestBody ProductInfo productInfo){ // json字符串
        return "product-service 接受到参数为 id:"+productInfo;
    }



}
